from llm import NovelLLM
from util import writeFile
from .base import BaseNode

class Step5Node(BaseNode):
    def run(self, state):
        prompt = """
#Task
人物大纲, 为每个主要角色撰写背景故事，包括成长经历、心理动机及与情节的关联，次要角色可简化

# 当前人物设定
{characters}""".format(characters=state['step4_output'])

        result = NovelLLM().call_llm(prompt, caller_name="Step5")
        state['step5_output'] = result
        writeFile("output/step5.txt", result)
        print(f"Step5 完成人物背景生成")
        return state